<script setup lang="ts">
//引入组件
import { getHomeBannerApi, getHomeCategoryAPI } from '@/services/home'
import CustomNavBar from './compontents/CustomNavBar.vue'
import { onLoad } from '@dcloudio/uni-app'
import { ref } from 'vue'
import type { BannerItem, CategoryItem } from '@/types/home'
import CategoryPanel from './compontents/CategoryPanel.vue'
import HotPanel from './compontents/HotPanel.vue'
const bannerList = ref<BannerItem[]>([])
const categoryPanelList = ref<CategoryItem[]>([])
const getHomeBannerData = async () => {
  const res = await getHomeBannerApi()
  // console.log(res)
  bannerList.value = res.result
}
const getHomeCategoryPanel = async () => {
  const res = await getHomeCategoryAPI()
  console.log(res)
  categoryPanelList.value = res.result
}
onLoad(() => {
  getHomeBannerData()
  getHomeCategoryPanel()
})
</script>

<template>
  <CustomNavBar />
  <XtxSwiper :list="bannerList" />
  <CategoryPanel :list="categoryPanelList" />
  <HotPanel />
  <XtxGuess />
  <view class="index"></view>
</template>

<style lang="scss">
//
page {
  background-color: #f7f7f7;
}
</style>
